﻿using LJX.SmartPark.Common.ResponseOutput;
using LJX.SmartPark.Domain.SafeManage.PatrolPerson;
using LJX.SmartPark.Domain.SysManage;
using LJX.SmartPark.Service.SafeManage;
using LJX.SmartPark.Service.SysManage;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static LJX.SmartPark.Service.SafeManage.PatrolPersonServeice;

namespace LJX.SmartPark.WebApi.Controllers.SafeManage
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = "SafeManage")]
    public class PatrolPersonController : ControllerBase
    {
        private readonly IPatrolPersonServeice _patrolPersonServeice;

        public PatrolPersonController(IPatrolPersonServeice patrolPersonServeice)
        {
            _patrolPersonServeice = patrolPersonServeice;
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<bool>> PostAddPatrolPerson(PatrolPerson input)
        {
            var result = _patrolPersonServeice.PostAddPatrolPersonAsync(input);
            return result;
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="input"></param>
        [HttpDelete]
        public Task<Response<bool>> DeletePatrolPerson(PatrolPerson input)
        {
            var result = _patrolPersonServeice.DeletePatrolPersonAsync(input);
            return result;
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<Response<bool>> PutUpdatePatrolPerson(PatrolPerson input)
        {
            var result = _patrolPersonServeice.PutUpdPatrolPersonAsync(input);

            return result;

        }

        /// <summary>
        /// 获取总条数
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public int GetCount()
        {
            return _patrolPersonServeice.GetCount();
        }

        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Response<List<PatrolPerson>> GetPatrolPersonAsync(Fy2 fy2)
        {
            var result = _patrolPersonServeice.GetPatrolPersonAsync(fy2);
            return result.Result;
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Response<PatrolPerson> GetPatrolPersonById(PatrolPerson input)
        {
            var result = _patrolPersonServeice.GetPatrolPersonById(input);
            return result;
        }
    }
}
